<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<h1>jQuery鼠标事件</h1>
<hr>
<div>
    用户名：<input type="text" id="username" value=""/><br>
    电子邮箱：<input type="text" id="email" value=""/><br>
</div>
<script>
    $(function () {
        $("#username").keypress(function (e) {
            console.log("in keypress username:" + $("#username").val());
            console.log("in keypress keycode:" + e.keyCode);
        })

        $("#email").keydown(function (e) {
            console.log("in keydown email:" + $("#email").val());
            console.log("in keydown keycode:" + e.keyCode);
        })

        $("#username,#email").keyup(function () {
            console.log("in keyup username:" + $("#username").val());
            console.log("in keyup email:" + $("#email").val());
        })
    })
</script>

</body>
</html>
